{if $class_count <20}
<div class="eject_con">
    <div id="warning" class="alert alert-error"></div>
    <form id="category_form" method="post" target="_parent" action="{:url('Selleralbum/album_add_save')}">
        <dl>
            <dt><i class="required">*</i>{$Think.lang.album_class_add_name}{$Think.lang.ds_colon}</dt>
            <dd>
                <input class="w300 text" type="text" name="name" id="name" value="" />
            </dd>
        </dl>
        <dl>
            <dt><i class="required">*</i>{$Think.lang.album_class_add_des}{$Think.lang.ds_colon}</dt>
            <dd>
                <textarea class="w300 textarea" rows="3" name="description" id="description"></textarea>
            </dd>
        </dl>
        <dl>
            <dt><i class="required">*</i>{$Think.lang.album_class_add_sort}{$Think.lang.ds_colon}</dt>
            <dd>
                <input class="w50 text" type="text" name="sort" id="sort" value="" />
            </dd>
        </dl>
        <div class="bottom">
            <input type="submit" class="submit" value="{$Think.lang.album_class_add_submit}" />
        </div>
    </form>
</div>
{else/}
<div class="warning-option"><i class="iconfont">&#xe64c;&nbsp;</i><span>{$Think.lang.album_class_add_max_20}</span></div>
{/if}
<script type="text/javascript">
    $(function() {
        $('#category_form').validate({
            errorLabelContainer: $('#warning'),
            invalidHandler: function(form, validator) {
                $('#warning').show();
            },
            submitHandler: function(form) {
                ds_ajaxpost('category_form')
            },
            rules: {
                name: {
                    required: true,
                    maxlength: 20,
                    remote: {
                        url: "{:url('Selleralbum/ajax_check_class_name',['column'=>'ok'])}",
                        type: 'get',
                        data: {
                            ac_name: function() {
                                return $('#name').val();
                            }
                        }
                    }
                },
                description: {
                    maxlength: 100
                },
                sort: {
                    digits: true
                }
            },
            messages: {
                name: {
                    required: '<i class="iconfont">&#xe64c;</i>{$Think.lang.album_class_add_name_null}',
                    maxlength: '<i class="iconfont">&#xe64c;</i>{$Think.lang.album_class_add_name_max}',
                    remote: '<i class="iconfont">&#xe64c;</i>{$Think.lang.album_class_add_name_repeat}'
                },
                description: {
                    maxlength: '<i class="iconfont">&#xe64c;</i>{$Think.lang.album_class_add_des_max}'
                },
                sort: {
                    digits: '<i class="iconfont">&#xe64c;</i>{$Think.lang.album_class_add_sort_digits}'
                }
            }
        });
    });
</script> 
